import { createApp } from "vue";
import { createPinia } from "pinia";
import { createPersistedState } from "pinia-plugin-persistedstate";

import "@/design/index.css";
import "element-plus/dist/index.css";
import App from "./App.vue";
import router from "./router";

import dayjs from "dayjs";
import "dayjs/locale/zh-cn";

dayjs.locale("zh-cn");

const pinia = createPinia();

console.info("应用名称:", __APP_ENV__.__APP_NAME__);
console.info("应用版本:", __APP_ENV__.__APP_VERSION__);
console.info("系统环境:", import.meta.env.MODE);

pinia.use(
  createPersistedState({
    key: (storeKey: string) => {
      return `${__APP_ENV__.__APP_NAME__}-${storeKey}-${__APP_ENV__.__APP_VERSION__}`;
    },
    storage: localStorage,
  })
);

const app = createApp(App);

app.use(pinia);
app.use(router);

app.mount("#app");
